package time.after.time.sys.utils;

import java.io.Serializable;

/**
 * 服务接口输出JSON数据
 * code{200:正常,404:请求服务不存在,503:服务不可用,500:服务器异常,400：错误请求,401:请求需要身份验证}
 * 
 * @author Aliyador create in 2011-6-14
 */
public class Result implements Serializable{
	
	private static final long serialVersionUID = 4790996250582020623L;
	
	public enum CodeStatus
	{
		SUCCESS(200),SERVICE_NOT_EXIST(404),SERVICE_UNUSE(503),SERVICE_EXCEPTION(500),
		ERROR_REQUEST(400),NEED_AUTHORIZED(401);
		private int code;
		CodeStatus(int code){this.code=code;}
		public int getCode(){return code;}
	}
	
	private Integer code;//返回状态码
    private String message;//返回消息
    private Object data;//返回数据

    public Result() {}

    public Result(Integer code) {
		super();
		this.code = code;
	}

	public Result(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Result(Integer code, String message, Object data) {
		super();
		this.code = code;
		this.message = message;
		this.data = data;
	}

	public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
